package com.bluesky.drcp.presentation.web;

import java.util.Enumeration;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.axis.session.Session;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class HelloAction extends Action {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		String d="";
		Enumeration em = request.getSession().getAttributeNames();
		while(em.hasMoreElements())
		{			
			d = d + (String)em.nextElement()+";";		
		}
		
		request.setAttribute("d",d);
		
		String paramAction = request.getParameter("action");
		if(paramAction==null)
			paramAction = "";
		if(!paramAction.equals("show"))
		{
			return mapping.findForward("success");			
		
		}
		else
		{
			HelloForm hf = (HelloForm)form;
			hf.setAttribute0(hf.getAttribute0() + hf.getAttribute0());
			
		
			return mapping.findForward("success");
		}
	}
}
